package com.pf.责任链模式.java;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GroupLeader extends Leader {

    public GroupLeader(String name) {
        super(name);
    }

    /**
     * 请假天数 <= 3天，由小组长审批
     *
     * @param leaveRequest
     */
    @Override
    public void handleRequest(LeaveRequest leaveRequest) {
        log.info("请假人：【{}】，请了{}天假，由小组长【{}】审批....", leaveRequest.getLeaveName(), leaveRequest.getLeaveDays(), this.getName());
        if (leaveRequest.getLeaveDays() > 3) {
            // 请假天数超过自己审批权限，交给下个审批人审批
            this.getNextLeader().handleRequest(leaveRequest);
        }
    }
}
